import Vue from "vue";
import VueRouter from "vue-router";

import Information from "@/views/Information";
import Layout from "@/views/Layout";
import Search from "@/views/Search";
import User from "@/views/User";

import Login from "@/views/Login";
import Enroll from "@/views/Enroll";

Vue.use(VueRouter);

const routes = [
  {
    // 登录页面
    path: "/enroll",
    component: Enroll,
  },
  {
    // 登录页面
    path: "/login",
    component: Login,
  },
  {
    // 主页面
    path: "/",
    component: Layout,
    children: [
      {
        // 资讯
        path: "/information",
        component: Information,
      },
      {
        // 搜索
        path: "/search",
        component: Search,
      },
      {
        // 我的
        path: "/user",
        component: User,
      },
      {
        // 首页
        path: "/layout",
        component: Layout,
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
